{:W('Header')}
<script>
    function changeAtt(t) {
        t.lastChild.checked = 'checked';
        for (var i = 0; i < t.parentNode.childNodes.length; i++) {
            if (t.parentNode.childNodes[i].className == 'cattsel') {
                t.parentNode.childNodes[i].className = '';
            }
        }
        t.className = "cattsel";
        changePrice();
    }
</script>
<script type="text/javascript">
    function $id(element) {
        return document.getElementById(element);
    }
    //切屏--是按钮，_v是内容平台，_h是内容库
    function reg(str) {
        var bt = $id(str + "_b").getElementsByTagName("h2");
        for (var i = 0; i < bt.length; i++) {
            bt[i].subj = str;
            bt[i].pai = i;
            bt[i].style.cursor = "pointer";
            bt[i].onclick = function () {
                $id(this.subj + "_v").innerHTML = $id(this.subj + "_h").getElementsByTagName("blockquote")[this.pai].innerHTML;
                for (var j = 0; j < $id(this.subj + "_b").getElementsByTagName("h2").length; j++) {
                    var _bt = $id(this.subj + "_b").getElementsByTagName("h2")[j];
                    var ison = j == this.pai;
                    _bt.className = (ison ? "" : "h2bg");
                }
            }
        }
        $id(str + "_h").className = "none";
        $id(str + "_v").innerHTML = $id(str + "_h").getElementsByTagName("blockquote")[0].innerHTML;
    }
</script>
<script type="text/javascript">
    $(function () {

        $(".mui-tab li").hover(function () {
            $(this).addClass("on");
            $(this).find(".left_conts").css("display", "block").stop(true, false).animate({
                "right": 35,
                "opacity": 1
            }, 200);
        }, function () {

            $(this).removeClass("on");
            $(this).find(".left_conts").stop(true, false).animate({"right": 70, "opacity": 0}, 200, function () {
                $(this).hide();
            });


        });

        $(".logo-qrcode").hover(function () {
            $(this).children(".mui-mbarp-qrcode-tip").css("visibility", "visible");
        }, function () {
            $(this).children(".mui-mbarp-qrcode-tip").css("visibility", "hidden");
        });

    });
    //
    var h = $(".Floatright_box").height();
    $(".Floatright_box").css({"margin-top": -h / 2});
</script>
<script>
    $(function () {
        isIe6 = false;

        if ('undefined' == typeof(document.body.style.maxHeight)) {
            isIe6 = true;
        }
        var offset = $("#topcontrol2").offset();
        var bottom = $("#topcontrol2").css("bottom");
        $(window).scroll(function () {
            if ($(window).scrollTop() > 500) {
                $("#topcontrol2").fadeIn(800);

                if (isIe6) {
                    $("#topcontrol2").css("position", "absolute")
                    $("#topcontrol2").css("bottom", bottom)
                }
            }
            else {
                $("#topcontrol2").fadeOut(500);
            }

        });

        $("#topcontrol2,#sider_returntop2").click(function () {
            $('body,html').animate({scrollTop: 0}, 500);
            return false;
        });
    })
</script>

<script type="text/javascript" src="__PUBLIC__/JS/js/left_goodslist.js"></script>
<script type="text/javascript" src="__PUBLIC__/JS/js/miqi_goods.js"></script>
<script type="text/javascript" src="__PUBLIC__/JS/js/magiczoomplus.js"></script>
<script>
    $(function () {
        /*放大镜缩略图左右切换效果*/
        $("#detail_img_slider").slide({
            mainCell: "#J_tabSlider ul",
            vis: 5,
            prevCell: ".pre_btn",
            nextCell: ".next_btn",
            effect: "leftLoop"
        })
        /*放大镜缩略图点击选中效果*/
        $("#J_tabSlider ul li a").click(function () {
            $("#J_tabSlider ul li").removeClass("cur");
            $(this).parent().addClass("cur");
        })
    })
</script>
<div class="detail_bg">
    <div class="content_title">
        <div class="block" style="margin:0 auto">
            <div id="ur_here"><span></span> <a href="{:U('/Index')}">首页</a> <code>&gt;</code>
                <foreach name="cateIdArr" item="v">
                    <a href="{:U(GROUP_NAME.'/Goods/showList',array('cate_id'=>$v['id']))}">{$v.cate_name}</a>
                    <code>&gt;</code>
                </foreach>
                {$goods.name}
            </div>
        </div>
    </div>
    <div class="detail_main">
        <div class="tm-detail-meta">
            <div id="goodsInfo" class="clearfix">
                <div class="mod_picfold clearfix">
                    <div id="detail_main_img" class="imgbox">
                        <div class="layout_wrap">
                            <div class="prodimg" title="{$goods.name}">
                                <a class="MagicZoomPlus" id="Zoomer"
                                   rel="hint-text: ; selectors-effect: false; selectors-class: on; zoom-distance: 22;zoom-width: 440; zoom-height: 440;">
                                    <img id="J_prodImg" src="{:U('/'.$goods['img'])}" alt="{$goods.name}"/></a>
                            </div>
                            <div class="tabbox clearfix">
                                <div id="detail_img_slider" class="imgtab">
                                    <div class="imgtab_clip" id="J_tabSlider">
                                        <ul class="imgtab_con">
                                            <foreach name="goods.images" item="v">
                                                <li class="cur"><a href=""
                                                                   rel="zoom-id: Zoomer"
                                                                   rev="{:U('/'.$v)}"><img
                                                        src="{:U('/'.$v)}"
                                                        alt="{$goods.name}"></a></li>
                                            </foreach>
                                        </ul>
                                    </div>
                                    <div id="detail_imgNextOrPreBtnDiv" class="imgtab_trrigle"><a
                                            href="javascript:void(0);" class="pre_btn"> << </a> <a
                                            href="javascript:void(0);" class="next_btn"> >></a></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="textInfo" style="float:right">
                <div class="center_title"><a><if condition="$goods.OTC_flag "><img src="{:U('/Public/Images/images/rx.png')}"></if> {$goods.name} {$goods.product_type}</a></div>
                <div class="brief"></div>
                <div class="detail_center">
                    <div class="center_txt">
                        <div class="center_text">
                            <p>商品货号：{$goods.goods_sn} </p>
                            <p>生产厂家：{$goods.factory_name}</p>
                            <p>规&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;格：{$goods.product_type}</p>
                            <p>总&nbsp;&nbsp;销&nbsp;&nbsp;量：{$goods.sale_num} </p>
                            <br>
                            <b style="display:none">本店售价：<font id="ECS_SHOPPRICE">￥{$goods.shop_price}元</font>
                            </b>
                            <ul class="tm-fcs-panel">
                                <li>
                                    <strong class="attr"> 优惠价: </strong> <span class="shop_price"
                                                                               id="ECS_GOODS_AMOUNT">￥{$goods.shop_price}元</span>
                                </li>
                                <li class="tm-price-panel">
                                    <span>原 价: </span> <font class="tm-price">￥{$goods.market_price}元</font>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                            <p style="display:none"> 商品总价：<font id="ECS_GOODS_AMOUNT" class="shop"></font></p>
                            <p style="display:none">
                            </p>
                        </div>
                    </div>
                    <div class="center_add"><p class="shuliang_tit">数量</p>
                        <div class="center_add_left">
                            <a onclick="buyNumber.minus()" href="javascript:;" class="jian"><img
                                    src="__PUBLIC__/Images/images/jian.gif"></a>
                            <input name="number" type="text" value="1" defaultnumber="1" onblur="changePrice()"
                                   id="product_num">
                            <a onclick="buyNumber.plus()" href="javascript:;" class="jia"><img
                                    src="__PUBLIC__/Images/images/jia.gif"/></a></div>
                        <span style="float:left; height:28px; line-height:28px;margin-right:10px;">{$goods.goods_unit}</span>
                        <p class="">
                            库存{$goods.num}{$goods.goods_unit}
                        </p>
                    </div>
                    <script>
                        function lalala() {
                            var shop_price1;
                            var goods_price1 = document.getElementById("goods_price").value;
                            var rx_number1 = document.getElementById("rx_number").value;
                            var isnumber = /^[0-9]+$/.test(rx_number1);
                            if (isnumber) {
                                shop_price1 = rx_number1 * goods_price1;
                                document.getElementById("total_price").value = shop_price1;
                            } else {
                                alert("您输入的是非数字");
                            }
                        }
                        var buyNumber = {
                            maxNumber: 100,
                            minNumber: 1,
                            defaultNumber: function () {
                                var defaultnumber = $('#product_num').attr('defaultnumber');
                                defaultnumber = parseInt(defaultnumber)
                                if (defaultnumber < 1) {
                                    defaultnumber = 1;
                                }
                                return defaultnumber;
                            },
                            goodNumber: function (num) {
                                if (typeof(num) == 'number') {
                                    return $('#product_num').val(num);
                                } else {
                                    return parseInt($('#product_num').val());
                                }
                            },
                            plus: function () {
                                var num = buyNumber.goodNumber() + buyNumber.defaultNumber();
                                if (num <= buyNumber.maxNumber) {
                                    buyNumber.goodNumber(num);
                                }
                            },
                            minus: function () {
                                var num = buyNumber.goodNumber() - buyNumber.defaultNumber();
                                if (num >= buyNumber.minNumber) {
                                    buyNumber.goodNumber(num);
                                }
                            }
                        }

                    </script>
                    <if condition="$goods.OTC_flag ">
                        <div class="center_btn">
                            <div id="modal-overlay" class="modal-overlay" style="visibility: hidden;">
                                <div class="modal-data">
                                    <div class="modal-header">
                                        <div class="modal-title"><p>需求登记 </p>
                                            <p class="modal-message"><em>温馨提示：</em>提交登记后 , 鹭燕大药房药师将在15分钟内致电与您联系！</p>
                                        </div>
                                    </div>
                                    <form action="{:U(GROUP_NAME.'/Order/addRX')}" method="post" enctype="multipart/form-data">
                                        <table>
                                            <div class="modal-item"><label>商城价：</label>￥<input name="shop_price"
                                                                                               type="text"
                                                                                               id="goods_price"
                                                                                               style="border:0; font-size:18px; font-color:#299DD4;"
                                                                                               value="{$goods.shop_price}"
                                                                                               readonly="ture"></div>
                                            <div class="modal-item"><label>总&nbsp;&nbsp;&nbsp;&nbsp;价：</label>￥<input
                                                    name="sum" type="text" id="total_price"
                                                    style="border:0; font-size:18px; font-color:#299DD4;"
                                                    value="{$goods.shop_price}" readonly="ture"></div>
                                            <div class="modal-item"><label>药品名：</label><input type="hidden"
                                                                                              name="goods_id"
                                                                                              value="{$goods.id}"><input
                                                    name="goods_name" type="text" class="form-control"
                                                    style="border:0;display: inline;" value="{$goods.name}"
                                                    readonly="ture"></div>
                                            <div class="modal-item"><label>姓&nbsp;&nbsp;&nbsp;&nbsp;名：</label><input
                                                    type="text" id="rx_name" name="rx_name" class="form-control"
                                                    placeholder="请输入您的姓名"></div>
                                            <!--<div class="modal-item"><label>微信号：</label><input type="text" id="rx_weixin_id" name="rx_weixin_id" class="form-control" placeholder="请输入您的微信号"></div>-->
                                            <div class="modal-item"><label>电&nbsp;&nbsp;&nbsp;&nbsp;话：</label><input
                                                    type="text" id="rx_phone" name="rx_phone" class="form-control"
                                                    onchange="checkMobile()" placeholder="请输入您的手机号"></div>
                                            <div class="modal-item"><label>数&nbsp;&nbsp;&nbsp;&nbsp;量：</label><input
                                                    type="number" min="1" id="rx_number" name="num"
                                                    class="form-control" onchange="lalala()" placeholder="请输入需要的数量">
                                            </div>
                                            <div class="modal-item"><label>地&nbsp;&nbsp;&nbsp;&nbsp;址：</label>
                                                <select name="store_id" class="form-control">
                                                    <foreach name="store" item="v">
                                                        <option value="{$v.id}">{$v.address}</option>
                                                    </foreach>
                                                </select>
                                            </div>
                                            <div class="modal-item"><label>处方单上传：&nbsp;&nbsp;</label>
                                                <input name="rx_image" type="file">
                                            </div>
                                            <div class="modal-footer">
                                                点击关闭按钮退出。
                                                <button type="button" class="btn btn-default" onclick="overlay()">关闭
                                                </button>
                                                <input type="submit" class="btn btn-primary" value="提交登记">
                                            </div>
                                        </table>
                                    </form>
                                </div>
                            </div>
                            <script>
                                function overlay() {
                                    var e1 = document.getElementById('modal-overlay');
                                    e1.style.visibility = (e1.style.visibility == "visible"  ) ? "hidden" : "visible";
                                    document.getElementById("inDetail_box").style.zIndex = 9;
                                }
                            </script>
                            <div class="center_pop_btn"
                                 style="width:167px;height:33px;float:none; margin-right:10px;float:left">
                                <a href="#" onclick="overlay()" style="
                                                      width:167px;height:33px;float:none;background:#B7733C; display:block; margin-bottom:10px;border-radius:3px;text-decoration:none;font-size:16px;text-align:center;color:#fff;line-height:33px;font-weight:700;">需求登记
                                </a>
                            </div>
                        </div>

                        <else/>
                        <div class="center_btn">
                            <div class="center_pop_btn"
                                 style="width:167px;height:33px;float:none; margin-right:10px;float:left">
                                <a href="javascript:void(0)" style="
                  width:167px;height:33px;background-repeat: no-repeat;float:none;
background-position: 0 0;background:url(__PUBLIC__/Images/images/que_g.png); display:block; margin-bottom:10px;"
                                   onclick="checkOut('{:U(GROUP_NAME."/Order/addOrder")}',{$goods.id})">
                                </a>
                            </div>
                            <div class="center_shop_btn"><a
                                    href='javascript:addToCartShowDiv({$goods.id},"{:U(GROUP_NAME.'/Cart/updateCart')}")'></a>
                            </div>
                        </div>
                    </if>

                </div>
            </div>
        </div>
    </div>
</div>
</div>

<div class="content_detailed">
    <div class="detail_middle ">
        <style type="text/css">
            .tip_spare {
                display: none
            }
        </style>
        <script type="text/javascript">
            var btn_buy = "确定";
            var is_cancel = "取消";
            var select_spe = "请选择商品属性";
            var select_base = '请选择套餐基本件';
            var select_shop = '请选择套餐商品';
            var data_not_complete = '数据格式不完整';
            var understock = '库存不足，请选择其他商品';
            jQuery(function ($) {
                //组合套餐tab切换
                var _tab = $('#cn_b h2');
                var _con = $('#cn_h blockquote');
                var _index = 0;
                _con.eq(0).show().siblings('blockquote').hide();
                _tab.css('cursor', 'pointer');
                _tab.click(function () {
                    _index = _tab.index(this);
                    _tab.eq(_index).removeClass('h2bg').siblings('h2').addClass('h2bg');
                    _con.eq(_index).show().siblings('blockquote').hide();
                })
                //选择基本件
                $('.m_goods_body').click(function () {
                    if ($(this).prop('checked')) {
                        ec_group_addToCart($(this).attr('item'), 4231); //基本件(组,主件)
                    } else {
                        ec_group_delInCart($(this).attr('item'), 4231); //删除基本件(组,主件)
                        display_Price($(this).attr('item'), $(this).attr('item').charAt($(this).attr('item').length - 1));
                    }
                })
                //变更选购的配件
                $('.m_goods_list').click(function () {
                    //是否选择主件
                    if (!$(this).parents('form').find('.m_goods_body').prop('checked')) {
                        alert(select_base);
                        return false;
                    }
                    if ($(this).prop('checked')) {
                        ec_group_addToCart($(this).attr('item'), $(this).val(), 4231); //新增配件(组,配件,主件)
                    } else {
                        ec_group_delInCart($(this).attr('item'), $(this).val(), 4231); //删除基本件(组,配件,主件)
                        display_Price($(this).attr('item'), $(this).attr('item').charAt($(this).attr('item').length - 1));
                    }
                })
                //可以购买套餐的最大数量
                $(".combo_stock").keyup(function () {
                    var group = $(this).parents('form').attr('name');
                    getMaxStock(group);//根据套餐获取该套餐允许购买的最大数
                });
            })
            //允许购买套餐的最大数量
            function getMaxStock(group) {
                var obj = $('input[name="' + group + '_number"]');
                var original = parseInt(Number(obj.val()));
                var stock = $("." + group).eq(0).attr('stock');
                //是否是数字
                if (isNaN(original)) {
                    original = 1;
                    obj.val(original);
                }
                $("." + group).each(function (index) {
                    if ($("." + group).eq(index).prop('checked')) {
                        var item_stock = parseInt($("." + group).eq(index).attr('stock'));
                        stock = (stock > item_stock) ? item_stock : stock;//取最小值
                    }
                });
                //更新
                original = (original < 1) ? 1 : original;
                stock = (stock < 1) ? 1 : stock;
                if (original > stock) {
                    obj.val(stock);
                }
            }
            //统计套餐价格
            function display_Price(_item, indexTab) {
                var _size = $('.' + _item).size();
                var _amount_shop_price = 0;
                var _amount_spare_price = 0;
                indexTab = indexTab - 1;
                for (i = 0; i < _size; i++) {
                    obj = $('.' + _item).eq(i);
                    if (obj.prop('checked')) {
                        _amount_shop_price += parseFloat(obj.attr('data')); //原件合计
                        _amount_spare_price += parseFloat(obj.attr('spare')); //优惠合计
                    }
                }
                var tip_spare = $('.tip_spare:eq(' + indexTab + ')');//节省文本
                if (_amount_spare_price > 0) {//省钱显示提示信息
                    tip_spare.show();
                    tip_spare.children('strong').text(_amount_spare_price);
                } else {
                    tip_spare.hide();
                }
                //显示总价
                $('.combo_price:eq(' + indexTab + ')').text(_amount_shop_price);
            }
            //处理添加商品到购物车
            function ec_group_addToCart(group, goodsId, parentId) {
                var goods = new Object();
                var spec_arr = new Array();
                var fittings_arr = new Array();
                var number = 1;
                var quick = 0;
                var group_item = (typeof(parentId) == "undefined") ? goodsId : parseInt(parentId);
                goods.quick = quick;
                goods.spec = spec_arr;
                goods.goods_id = goodsId;
                goods.number = number;
                goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
                goods.group = group + '_' + group_item;//组名
                Ajax.call('flow.php?step=add_to_cart_combo', 'goods=' + $.toJSON(goods), ec_group_addToCartResponse, 'POST', 'JSON'); //兼容jQuery by mike
            }
            //处理添加商品到购物车的反馈信息
            function ec_group_addToCartResponse(result) {
                if (result.error > 0) {
                    // 如果需要缺货登记，跳转
                    if (result.error == 2) {
                        alert(understock);
                        cancel_checkboxed(result.group, result.goods_id);//取消checkbox
                    }
                    // 没选规格，弹出属性选择框
                    else if (result.error == 6) {
                        ec_group_openSpeDiv(result.message, result.group, result.goods_id, result.parent);
                    }
                    else {
                        alert(result.message);
                        cancel_checkboxed(result.group, result.goods_id);//取消checkbox
                    }
                }
                else {
                    //处理Ajax数据
                    var group = result.group.substr(0, result.group.lastIndexOf("_"));
                    $("." + group).each(function (index) {
                        if ($("." + group).eq(index).val() == result.goods_id) {
                            //主件显示价格、配件显示基本件+属性价
                            var goods_price = (result.parent > 0) ? (parseFloat(result.fittings_price) + parseFloat(result.spec_price)) : result.goods_price;
                            $("." + group).eq(index).attr('data', goods_price);//赋值到文本框data参数
                            $("." + group).eq(index).attr('stock', result.stock);//赋值到文本框stock参数
                            $('.' + group + '_display').eq(index).text(goods_price);//前台显示
                        }
                    });
                    getMaxStock(group);//根据套餐获取该套餐允许购买的最大数
                    display_Price(group, group.charAt(group.length - 1));//显示套餐价格
                }
            }
            //处理删除购物车中的商品
            function ec_group_delInCart(group, goodsId, parentId) {
                var goods = new Object();
                var group_item = (typeof(parentId) == "undefined") ? goodsId : parseInt(parentId);
                goods.goods_id = goodsId;
                goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
                goods.group = group + '_' + group_item;//组名
                Ajax.call('flow.php?step=del_in_cart_combo', 'goods=' + $.toJSON(goods), ec_group_delInCartResponse, 'POST', 'JSON'); //兼容jQuery by mike
            }
            //处理删除购物车中的商品的反馈信息
            function ec_group_delInCartResponse(result) {
                var group = result.group;
                if (result.error > 0) {
                    alert(data_not_complete);
                } else if (result.parent == 0) {
                    $('.' + group).attr("checked", false);
                }
                display_Price(group, group.charAt(group.length - 1));//显示套餐价格
            }
            //生成属性选择层
            function ec_group_openSpeDiv(message, group, goods_id, parent) {
                var _id = "speDiv";
                var m = "mask";
                if (docEle(_id)) document.removeChild(docEle(_id));
                if (docEle(m)) document.removeChild(docEle(m));
                //计算上卷元素值
                var scrollPos;
                if (typeof window.pageYOffset != 'undefined') {
                    scrollPos = window.pageYOffset;
                }
                else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
                    scrollPos = document.documentElement.scrollTop;
                }
                else if (typeof document.body != 'undefined') {
                    scrollPos = document.body.scrollTop;
                }
                var i = 0;
                var sel_obj = document.getElementsByTagName('select');
                while (sel_obj[i]) {
                    sel_obj[i].style.visibility = "hidden";
                    i++;
                }
                // 新激活图层
                var newDiv = document.createElement("div");
                newDiv.id = _id;
                newDiv.style.position = "absolute";
                newDiv.style.zIndex = "10000";
                newDiv.style.width = "300px";
                newDiv.style.height = "260px";
                newDiv.style.top = (parseInt(scrollPos + 200)) + "px";
                newDiv.style.left = (parseInt(document.body.offsetWidth) - 200) / 2 + "px"; // 屏幕居中
                newDiv.style.overflow = "auto";
                newDiv.style.background = "#FFF";
                newDiv.style.border = "3px solid #59B0FF";
                newDiv.style.padding = "5px";
                //生成层内内容
                newDiv.innerHTML = '<h4 style="font-size:14; margin:15 0 0 15;">' + select_spe + "</h4>";
                for (var spec = 0; spec < message.length; spec++) {
                    newDiv.innerHTML += '<hr style="color: #EBEBED; height:1px;"><h6 style="text-align:left; background:#ffffff; margin-left:15px;">' + message[spec]['name'] + '</h6>';
                    if (message[spec]['attr_type'] == 1) {
                        for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++) {
                            if (val_arr == 0) {
                                newDiv.innerHTML += "<input style='margin-left:15px;' type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' checked /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
                            }
                            else {
                                newDiv.innerHTML += "<input style='margin-left:15px;' type='radio' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + '</font> [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
                            }
                        }
                        newDiv.innerHTML += "<input type='hidden' name='spec_list' value='" + val_arr + "' />";
                    }
                    else {
                        for (var val_arr = 0; val_arr < message[spec]['values'].length; val_arr++) {
                            newDiv.innerHTML += "<input style='margin-left:15px;' type='checkbox' name='spec_" + message[spec]['attr_id'] + "' value='" + message[spec]['values'][val_arr]['id'] + "' id='spec_value_" + message[spec]['values'][val_arr]['id'] + "' /><font color=#555555>" + message[spec]['values'][val_arr]['label'] + ' [' + message[spec]['values'][val_arr]['format_price'] + ']</font><br />';
                        }
                        newDiv.innerHTML += "<input type='hidden' name='spec_list' value='" + val_arr + "' />";
                    }
                }
                newDiv.innerHTML += "<br /><center>[<a href='javascript:ec_group_submit_div(\"" + group + "\"," + goods_id + "," + parent + ")' class='f6' >" + btn_buy + "</a>]&nbsp;&nbsp;[<a href='javascript:ec_group_cancel_div(\"" + group + "\"," + goods_id + ")' class='f6' >" + is_cancel + "</a>]</center>";
                document.body.appendChild(newDiv);
                // mask图层
                var newMask = document.createElement("div");
                newMask.id = m;
                newMask.style.position = "absolute";
                newMask.style.zIndex = "9999";
                newMask.style.width = document.body.scrollWidth + "px";
                newMask.style.height = document.body.scrollHeight + "px";
                newMask.style.top = "0px";
                newMask.style.left = "0px";
                newMask.style.background = "#FFF";
                newMask.style.filter = "alpha(opacity=30)";
                newMask.style.opacity = "0.40";
                document.body.appendChild(newMask);
            }
            //获取选择属性后，再次提交到购物车
            function ec_group_submit_div(group, goods_id, parentId) {
                var goods = new Object();
                var spec_arr = new Array();
                var fittings_arr = new Array();
                var number = 1;
                var input_arr = document.getElementById('speDiv').getElementsByTagName('input'); //by mike
                var quick = 1;
                var spec_arr = new Array();
                var j = 0;
                for (i = 0; i < input_arr.length; i++) {
                    var prefix = input_arr[i].name.substr(0, 5);
                    if (prefix == 'spec_' && (
                                    ((input_arr[i].type == 'radio' || input_arr[i].type == 'checkbox') && input_arr[i].checked))) {
                        spec_arr[j] = input_arr[i].value;
                        j++;
                    }
                }
                goods.quick = quick;
                goods.spec = spec_arr;
                goods.goods_id = goods_id;
                goods.number = number;
                goods.parent = (typeof(parentId) == "undefined") ? 0 : parseInt(parentId);
                goods.group = group;//组名
                Ajax.call('flow.php?step=add_to_cart_combo', 'goods=' + $.toJSON(goods), ec_group_addToCartResponse, 'POST', 'JSON'); //兼容jQuery by mike
                document.body.removeChild(docEle('speDiv'));
                document.body.removeChild(docEle('mask'));
                var i = 0;
                var sel_obj = document.getElementsByTagName('select');
                while (sel_obj[i]) {
                    sel_obj[i].style.visibility = "";
                    i++;
                }
            }
            //关闭mask和新图层的同时取消选择
            function ec_group_cancel_div(group, goods_id) {
                document.body.removeChild(docEle('speDiv'));
                document.body.removeChild(docEle('mask'));
                var i = 0;
                var sel_obj = document.getElementsByTagName('select');
                while (sel_obj[i]) {
                    sel_obj[i].style.visibility = "";
                    i++;
                }
                cancel_checkboxed(group, goods_id);//取消checkbox
            }
            /*
             *套餐提交到购物车 by mike
             */
            function addMultiToCart(group, goodsId) {
                var goods = new Object();
                var number = $('input[name="' + group + '_number"]').val();

                goods.group = group;
                goods.goods_id = goodsId;
                goods.number = (number < 1) ? 1 : number;

                //判断是否勾选套餐
                if (!$("." + group).is(':checked')) {
                    alert(select_shop);
                    return false;
                }

                Ajax.call('flow.php?step=add_to_cart_group', 'goods=' + $.toJSON(goods), addMultiToCartResponse, 'POST', 'JSON'); //兼容jQuery by mike
            }
            //回调
            function addMultiToCartResponse(result) {
                if (result.error > 0) {
                    alert(result.message);
                } else {
                    window.location.href = 'flow.php';
                }
            }
            //取消选项
            function cancel_checkboxed(group, goods_id) {
                //取消选择
                group = group.substr(0, group.lastIndexOf("_"));
                $("." + group).each(function (index) {
                    if ($("." + group).eq(index).val() == goods_id) {
                        $("." + group).eq(index).attr("checked", false);
                    }
                });
            }
            /*
             //sleep
             function sleep(d){
             for(var t = Date.now();Date.now() - t <= d;);
             }
             */
        </script>
        <div class="block clearfix">
            <div class="AreaL" style=" width:190px;">
                <div class="good_top10">
                    <h3><span>热销排行榜</span></h3>
                    <div class="news_left">
                        <ul>
                            <foreach name="hot" item="v">
                                <li>
                                    <div class="topimg"><a href="{:U(GROUP_NAME.'/Goods/index',array('id'=>$v['id']))}"><img
                                            src="{:U('/'.$v['img'])}" alt="{$v.name}"
                                            style=" width:42px; height:42px"/></a></div>
                                    <div class="top_txt"><b><a href="{:U(GROUP_NAME.'/Goods/index',array('id'=>$v['id']))}" title="{$v.name}">{$v.name}</a></b>
                                        <p><font class="f1">￥{$v.shop_price}元</font></p>
                                        <p>已售出{$v.sale_num}笔</p>
                                    </div>
                                </li>
                            </foreach>
                        </ul>
                    </div>
                </div>
                <div class="blank5"></div>
                <script type="text/javascript">
                    //<![CDATA[
                    var cycleList = ['ECS_tree1', 'ECS_tree2'];
                    var tabFront = 'tabFront';
                    var tabBack = 'tabBack';
                    function cycleShow(obj) {
                        var curObj;
                        var curBody;
                        for (i = 0; i < cycleList.length; i++) {
                            curObj = document.getElementById(cycleList[i]);
                            curBody = document.getElementById(cycleList[i] + '_BODY');
                            if (obj.id == curObj.id) {
                                curObj.className = tabFront;
                                curBody.style.display = "";
                            }
                            else {
                                curObj.className = tabBack;
                                curBody.style.display = "none";
                            }
                        }
                    }
                    // 添加事件
                    for (i = 0; i < cycleList.length; i++) {
                        document.getElementById(cycleList[i]).onmousemove = function () {
                            cycleShow(this);
                        };
                    }
                    //]]>
                </script>
            </div>
            <div class="AreaR_goods">
                <div class="inDetail_boxOut ">
                    <div class="inDetail_box">
                        <div class="fixed_out ">
                            <div id="inner" class="fixed"
                                 style="background-color:#fff; border-bottom:2px solid #299DD4">
                                <ul class="inLeft_btn">
                                    <li><a id="detail-id" href="#shangp" class="current">商品介绍</a></li>
                                </ul>
                            </div>
                        </div>
                        <script type="text/javascript">
                            var obj11 = document.getElementById("inner");
                            var top11 = getTop(obj11);
                            var isIE6 = /msie 6/i.test(navigator.userAgent);
                            window.onscroll = function () {
                                var bodyScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
                                if (bodyScrollTop > top11) {
                                    obj11.style.position = (isIE6) ? "absolute" : "fixed";
                                    obj11.style.top = (isIE6) ? bodyScrollTop + "px" : "0px";
                                } else {
                                    obj11.style.position = "static";
                                }
                            }
                            function getTop(e) {
                                var offset = e.offsetTop;
                                if (e.offsetParent != null) offset += getTop(e.offsetParent);
                                return offset;
                            }
                        </script>
                        <div id="no_try_record">
                            <div class="inLeft_attributes clearfix" style="margin:0;">
                                <div class="inLeft_attributes_1">
                                    <div class="inLeft_title property_title" style="margin-top:55px;">
                                    </div>
                                    <h3 class="inLeft_attributes" id="shangp"><span class="fit_people ">商品名称: &nbsp;&nbsp;{$goods.name}</span>
                                    </h3>
                                </div>
                                <div style="margin-top:20px">
                                    <p>
                                        {$goods.content}
                                    </p>
                                </div>
                            </div>
                        </DIV>
                    </div>
                </div>
                <div class="blank"></div>
            </div>
        </div>
    </div>
</div>
<div class="blank5"></div>
<script type="text/javascript">
    var goods_id = 4231;
    var goodsattr_style = 1;
    var gmt_end_time = 0;
    var day = "天";
    var hour = "小时";
    var minute = "分钟";
    var second = "秒";
    var end = "结束";
    var goodsId = 4231;
    var now_time = 1489471588;
    onload = function () {
        changePrice();
        fixpng();
        try {
            onload_leftTime();
        }
        catch (e) {
        }
    }
    /**
     * 点选可选属性或改变数量时修改商品价格的函数
     */
    function changePrice() {
        var attr = getSelectedAttributes(document.forms['ECS_FORMBUY']);
        var qty = document.forms['ECS_FORMBUY'].elements['number'].value;
        Ajax.call('goods.php', 'act=price&id=' + goodsId + '&attr=' + attr + '&number=' + qty, changePriceResponse, 'GET', 'JSON');
    }
    /**
     * 接收返回的信息
     */
    function changePriceResponse(res) {
        if (res.err_msg.length > 0) {
            alert(res.err_msg);
        }
        else {
            document.forms['ECS_FORMBUY'].elements['number'].value = res.qty;
            if (document.getElementById('ECS_GOODS_AMOUNT'))
                document.getElementById('ECS_GOODS_AMOUNT').innerHTML = res.result;
        }
    }

</script>
{:W("Footer")}
